package com.codes.api.user;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @Description 
 * @Date 2020/7/30 10:37
 * @Created  peanut
 */
public class StringTestCtr {

    public static String defaultFormat = "yyyy-MM-dd HH:mm:ss";
    public static String defaultFormat2 = "yyyy-MM-dd";
    public static String ymd = "yyyy年MM月dd日";
    public static String ymdHs = "yyyy年MM月dd日HH时mm分";
    public static String ymdhm = "yyyy-MM-dd HH:mm";

    public static void main(String[] args) throws ParseException {

        String dd = "2020-08-09 11:33:22";
        // String fd =  getyyyy_MM_dd(dd);
//        System.out.println(fd);


    }

    // 字符串 返回 年 月 日
    public static Date getyyyy_MM_dd(String date) throws ParseException {
        if (null == date) return null;
        SimpleDateFormat sdf = new SimpleDateFormat(ymd);
       return sdf.parse(date);
        // return sdf.format(date);
    }

}